/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Gao zhao xu
 * Date: 2023-12-17
 * Time: 下午 06:33
 */
public class Test1 {
    public static boolean floyd(String[] v, double[][] matrix) {
        int n = v.length;
        for (int k = 0; k < n; k++) {
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (matrix[i][j] < matrix[i][k] * matrix[k][j])   //关键点
                        matrix[i][j] = matrix[i][k] * matrix[k][j];
                }
            }
        }
        for (int i = 0; i < n; i++) {
            if (matrix[i][i] > 1)
                return true;
        }
        return false;
    }

    public static void main(String[] args) {
        String[] v = { "美元", "人民币", "英镑"};
        double[][] matrix = {{0, 7.51, 2.03}, {7.15, 0, 0.07}, {2.03, 0.07, 0}};
        System.out.println(floyd(v,matrix));
    }


}
